<?php
error_reporting(0);
$isadmin=1;    
include '../../comm/config.php';
include '../check.php';
include('../../comm/class_db.php');
include_once '../include/page.class.php';

$page = !($_GET['page'])?'1':intval($_GET['page']);
$pagesize=10;
$page2=($page-1)*$pagesize;

$keyword=$_GET['keyword'];
$px=$_GET['px'];

$sql="select id from ".$BIAOTOU."mall where `name` like '%".$keyword."%'";
$query=mysql_query($sql);
$total=mysql_num_rows($query);

if($px=='desc'){
    $order=" order by end_time desc";
}
elseif($px=='asc'){
    $order=" order by end_time asc";
}
else{
    $order=" order by id desc";
}
$sql="select * from ".$BIAOTOU."mall where `name` like '%".$keyword."%'  ". $order." limit $page2,$pagesize";
$rs = mysql_query($sql);
mysql_close();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>管理中心</title>
<link href="../css/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FFFFFF;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
.STYLE2 {
	color: #555555;
	font-weight: bold;
	font-size:14px;
	text-decoration:none;
}
-->
</style>
</head>

<body topmargin="5" leftmargin="0">
<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="282" valign="top"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td>
          <table cellspacing="0" width="100%" height="207" style="border:1px  solid #DCEAF7;">
            <tr>
              <td width="358" height="30" align="left" bgcolor="E9F2FB" class="bigtext"><strong>&nbsp;<img src="../images/arrow.gif" width="16" height="22" align="absmiddle" /> 内容管理 [ <a href="mall.php" class="link3">添加商城</a> ] </strong></td>
              <form id="form1" name="form1" method="get" action="">
              <input type="hidden" name="action" value="malllist"  />
              <td width="479" align="left" bgcolor="E9F2FB" class="bigtext">
              商城名<input type="text" class="button3" name="keyword" />
                <input type="submit" name="Submit" value="查找" />
                </td></form>
              <td width="130" height="30" align="right" bgcolor="E9F2FB" class="bigtext">共有 <b><?php echo $total;?></b> 条记录&nbsp;&nbsp;</td>
            </tr>
            <tr>
              <td colspan="3" valign="top"><table width="100%" height="300" border="0" cellpadding="0" cellspacing="0">
                <tr>
                  <td valign="top"><table width="100%" border=1 cellpadding=0 cellspacing=0
style="border-collapse: collapse" bordercolor="#dddddd">
                    <tr>
                      <td width="15%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>商城名</strong></td>
                      <td width="" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>商城logo</strong></td>
                      <td width="18%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>网址</strong></td>
                      <td width="8%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>所属联盟</strong></td>
                      <td width="8%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>最高返</strong></td>
                      <td width="8%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>类别</strong></td> 
                      <td width="10%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>到期时间<?php if($px=="desc"){echo "<a href=\"malllist.php?px=asc\"><img src='../images/up.gif' title='向下排序'/></a>";}elseif($px=="asc"){echo "<a href=\"malllist.php?px=desc\"><img src='../images/drop.gif' title='向上排序'/></a>";}else{echo "<a href=\"malllist.php?px=asc\"><img src='../images/nochoice.gif' title='未选中'/></a>";}?></strong></td>                     
                      <td width="12%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>操作</strong></td>
                      <td width="14%" height="30" align="center" bgcolor="#F2F2F2" class="bigtext"><strong>时间</strong></td>
                    </tr>
                    <?php
					while ($row = mysql_fetch_array($rs))
					{
						echo "<tr>";
                      	echo "<td height=30 align=\"center\" class=bigtext>".$row["name"]."</td>";
                      	echo "<td height=30 align=\"center\" class=bigtext><img height='30px' width='60px' src=".$row["logo"]." /></td>";
						echo "<td height=30 align=\"center\" class=bigtext>".$row["url"]."</td>";
						echo "<td height=30 align=\"center\" class=bigtext>".$row["lm"]."</td>";
						echo "<td height=30 align=\"center\" class=bigtext>".$row["fan"]."</td>";
						echo "<td align=\"center\" class=bigtext id=ss>".ShowSC($row["catid"])."</td>";	
						echo "<td height=30 align=\"center\" class=bigtext>".$row["end_time"]."</td>";
						echo "<td align=\"center\" class=bigtext><a href=mall.php?id=".$row["id"]." class=link4>修改</a> <a href=malldel.php?id=".$row["id"]." class=link4 onclick='return confirm(\"确定要删除?\")' >删除</a></td>";
						echo "<td align=\"center\" class=bigtext align=center>".$row["time"]."</td>";	
						echo "</tr>";
					}
					?>
                    <tr>
                      <td height="43" colspan="11" align="center"><div id="pages">
                          <div class="yahoo2" style=" margin-top:30px;"><?php 
				pageft($total,$pagesize,1,1,0,10,"malllist.php?keyword=".urlencode($keyword).'&px='.$px);
				echo $pagenav;?></div>
                      </div></td>
                    </tr>
                  </table></td>
                </tr>
              </table></td>
            </tr>
          </table></td>
        </tr>
      
    </table></td>
  </tr>
</table>
</body>
</html>